// 操作符复写
void main(List<String> args) {
  Person person1 = Person(18);
  Person person2 = Person(20);

  print(person1>person2);
  print(person1["age"]);
}

class Person {
  int age;
  Person(this.age);

  // 复写 > 符号
  bool operator > (Person other) {
    return this.age > other.age;
  }

  //  复写 [] 符号
  int operator [] (String str) {
    if (str == "age") {
      return age;
    }
    return 0;
  }
  
}